<div>

    <h2 translate="jhipsterApp.author.home.title">Authors</h2>

    <div class="container">
        <div class="row">
            <div class="col-md-4">
                <button class="btn btn-primary" data-toggle="modal" data-target="#saveAuthorModal" ng-click="clear()">
                    <span class="glyphicon glyphicon-flash"></span> <span translate="jhipsterApp.author.home.createLabel">Create a new Author</span>
                </button>
            </div>
        </div>
    </div>

    <div class="modal fade" id="saveAuthorModal" tabindex="-1" role="dialog" aria-labelledby="myAuthorLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <form name="editForm" role="form" novalidate ng-submit="save()" show-validation>

                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                                ng-click="clear()">&times;</button>
                        <h4 class="modal-title" id="myAuthorLabel" translate="jhipsterApp.author.home.createOrEditLabel">Create or edit a Author</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label>ID</label>
                            <input type="text" class="form-control" name="id"
                                   ng-model="author.id" readonly>
                        </div>

                        <div class="form-group">
                            <label translate="jhipsterApp.author.name">Name</label>
                            <input type="text" class="form-control" name="name"
                                   ng-model="author.name">

                        </div>
                        <div class="form-group">
                            <label translate="jhipsterApp.author.year">Year</label>
                            <input type="number" class="form-control" name="year"
                                   ng-model="author.year" required>

                            <div ng-show="editForm.year.$invalid">
                                <p class="help-block"
                                   ng-show="editForm.year.$error.required" translate="entity.validation.required">
                                    This field is required.
                                </p>
                                <p class="help-block"
                                   ng-show="editForm.year.$error.number" translate="entity.validation.number">
                                    This field should be a number.
                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label translate="jhipsterApp.author.birthDate">BirthDate</label>
                            <input type="date" class="form-control" name="birthDate"
                                   ng-model="author.birthDate" required>

                            <div ng-show="editForm.birthDate.$invalid">
                                <p class="help-block"
                                   ng-show="editForm.birthDate.$error.required" translate="entity.validation.required">
                                    This field is required.
                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label translate="jhipsterApp.author.sex">Sex</label>
                            <input type="checkbox" class="form-control" name="sex"
                                   ng-model="author.sex">

                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="clear()">
                            <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span translate="entity.action.cancel">Cancel</span>
                        </button>
                        <button type="submit" ng-disabled="editForm.$invalid" class="btn btn-primary">
                            <span class="glyphicon glyphicon-save"></span>&nbsp;<span translate="entity.action.save">Save</span>
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="modal fade" id="deleteAuthorConfirmation">
        <div class="modal-dialog">
            <div class="modal-content">
                <form name="deleteForm" ng-submit="confirmDelete(author.id)">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                                ng-click="clear()">&times;</button>
                        <h4 class="modal-title" translate="entity.delete.title">Confirm delete operation</h4>
                    </div>
                    <div class="modal-body">
                        <p translate="jhipsterApp.author.delete.question" translate-values="{id: '{{author.id}}'}">Are you sure you want to delete this Author?</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="clear()">
                            <span class="glyphicon glyphicon-ban-circle"></span>&nbsp;<span translate="entity.action.cancel">Cancel</span>
                        </button>
                        <button type="submit" ng-disabled="deleteForm.$invalid" class="btn btn-danger">
                            <span class="glyphicon glyphicon-remove-circle"></span>&nbsp;<span translate="entity.action.delete">Delete</span>
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>ID</th>
                    <th translate="jhipsterApp.author.name">Name</th>
                    <th translate="jhipsterApp.author.year">Year</th>
                    <th translate="jhipsterApp.author.birthDate">BirthDate</th>
                    <th translate="jhipsterApp.author.sex">Sex</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="author in authors">
                    <td><a ui-sref="authorDetail({id:author.id})">{{author.id}}</a></td>
                    <td>{{author.name}}</td>
                    <td>{{author.year}}</td>
                    <td>{{author.birthDate}}</td>
                    <td>{{author.sex}}</td>
                    <td>
                        <button type="submit"
                                ui-sref="authorDetail({id:author.id})"
                                class="btn btn-info btn-sm">
                            <span class="glyphicon glyphicon-eye-open"></span>&nbsp;<span translate="entity.action.view"> View</span>
                        </button>
                        <button type="submit"
                                ng-click="showUpdate(author.id)"
                                class="btn btn-primary btn-sm">
                            <span class="glyphicon glyphicon-pencil"></span>&nbsp;<span translate="entity.action.edit"> Edit</span>
                        </button>
                        <button type="submit"
                                ng-click="delete(author.id)"
                                class="btn btn-danger btn-sm">
                            <span class="glyphicon glyphicon-remove-circle"></span>&nbsp;<span translate="entity.action.delete"> Delete</span>
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
        <nav>
            <ul class="pager">
                <li ng-show="links['first']" ng-click="loadPage(links['first'])"><a href="#">&lt;&lt;</a></li>
                <li ng-show="links['prev']" ng-click="loadPage(links['prev'])"><a href="#">&lt;</a></li>
                <li ng-show="links['next']" ng-click="loadPage(links['next'])"><a href="#">&gt;</a></li>
                <li ng-show="links['last']" ng-click="loadPage(links['last'])"><a href="#">&gt;&gt;</a></li>
            </ul>
        </nav>
    </div>
</div>
